package com.sayice.robotconflict.game.object.logic;

import java.util.function.BiPredicate;

/**
 * 逻辑操作符
 *
 * @author shubing
 */
public enum LogicOperator {
    AND((a, b) -> a && b),
    OR((a, b) -> a || b);
    
    private final BiPredicate<Boolean, Boolean> operator;
    
    LogicOperator(BiPredicate<Boolean, Boolean> operator) {
        this.operator = operator;
    }
    
    public boolean apply(boolean a, boolean b) {
        return operator.test(a, b);
    }
}
